<template>
  <div>
    <div class="toast" v-show="isShow">
      <div>{{ message }}</div>
    </div>
  </div>
</template>

<script>
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Toast",

  data() {
    return {
      isShow: false,
      message: "",
    };
  },

  mounted() {},

  methods: {
    Show(message = "默认文字", duration = "1000") {
      this.isShow = true;
      this.message = message;
      setTimeout(() => {
        this.isShow = false;
        this.message = "";
      }, duration);
    },
  },
};
</script>

<style lang="less" scoped>
.toast {
  z-index: 999;
  position: fixed;
  top: 50%;
  left: 50%;
transform: translate(-50%,-50%);
  background: var(--color-tint);
  opacity: 0.7;
  color:#fff;
  padding:10px;
}
</style>
